Letter columns diagrams

Here we plot the columns of the diagrams in order to show how the task works.


In [5]:
import numpy as np
import h5py
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec

%matplotlib inline

In [4]:
signal_location = '../data/wall_street_data_30.hdf5'

# Access the data and load it into signal
with h5py.File(signal_location, 'r') as f:
    dset = f['signal']
    signals = np.empty(dset.shape, np.float)
    dset.read_direct(signals)

letter = signals[0, ...]

In [6]:
Nletters = 8
length = 10
cmap = 'seismic'
cmap = 'gray'
interpolation = 'nearest'


gs = gridspec.GridSpec(2, Nletters)
middle = (Nletters // 2 )
fig = plt.figure(figsize=(16, 12))
ax = fig.add_subplot(gs[0, (middle - 1):(middle + 1)])
ax.imshow(letter, cmap=cmap)
ax.set_axis_off()

for i in range(Nletters):
    ax = fig.add_subplot(gs[1, i])
    ax.imshow(letter[:, i:(i+length)], cmap=cmap)
    ax.set_axis_off()